<?php 
session_start();
	 /* les requires à mettre au dessus de 
	 Hook::call("KERNEL.FILE.TOP.CODE.EXECUTE"); */
	$erreurKernel = "Un ou plusieurs élément(s) indispensable au bon fonctionnement du site est/sont absent(s), Merci de contactez le <a href='mailto:leprojet@legtux.org'>webmaster du site</a> pour l'avertir de cette erreur N°";
	
	require_once('./includes/constantes.inc.php');
		if(!defined("DIR_INCLUDE"))
			exit($erreurKernel . " (0xC00)");  
			  
	if(@!require_once(DIR_INCLUDE . '/classes/Hook.abstract.class.php'))
		exit($erreurKernel . " (0xC01)");
	
//error_reporting(E_WARNING | E_PARSE);
error_reporting(E_ALL);
//header("Cache-Control: no-cache, must-revalidate");

ob_start();	
	//on commence ici les require du programme
    if(!@require_once(DIR_INCLUDE . '/function.inc.php'))
		exit($erreurKernel . " (0xC02)");
    if(!@require_once(DIR_INCLUDE . '/bbcode.inc.php'))
		exit($erreurKernel . " (0xC03)");
    if(!@require_once(DIR_INCLUDE . '/pdo.inc.php'))
		exit($erreurKernel . " (0xC04)");
    if(!@require_once(DIR_INCLUDE . '/date.php'))
		exit($erreurKernel . " (0xC05)");
    if(!@require_once(DIR_INCLUDE . '/class_date.php'))
		exit($erreurKernel . " (0xC06)");
    if(!@require_once(DIR_INCLUDE . '/fil_ariane.php'))
		exit($erreurKernel . " (0xC07)");
    if(!@require_once(DIR_INCLUDE . '/classes/HeaderMail.class.php'))
		exit($erreurKernel . " (0xC08)");
    if(!@require_once(DIR_INCLUDE . '/classes/Mail.class.php'))
		exit($erreurKernel . " (0xC09)");
    if(!@require_once(DIR_INCLUDE . '/Hook.config.php'))
		exit($erreurKernel . " (0xC010)");
   /* if(!@require_once(DIR_INCLUDE . '/message.haut.php'))
		exit($erreurKernel . " (0xC011)");*/
		
		//var_dump($_SERVER['REQUEST_URI']);
		saveUrl($_SERVER['REQUEST_URI']);
   	if(!@require_once(DIR_INCLUDE . '/communications.inc.php'))
		exit($erreurKernel . " (0xC011)");
		include "./includes/message.haut.php";
		include "./includes/titre.php";
	Hook::call("KERNEL.FILE.TOP.CODE.EXECUTE");

		//global $pdo, $pageTitle; //, $isRedirected;
		
			//$pageContent = "<div class='message'>".$msg."</div>";
	
		
		//
		$path = substr($_SERVER['REQUEST_URI'],strpos($_SERVER['REQUEST_URI'],"//"));
		$epath = explode("/",$path);
		 $bpath = "";
		 	
			
		 	for($i=0;$i<count($epath)-1;$i++)
			{
				if($i > 0 && $i%2==0)
					$bpath .= "/";
				
				$bpath .= ".";
				
			}
	?>	
<!DOCTYPE html>
  <html lang="fr">
  
    <head>
    <?php 
	$desc = $pdo->query("SELECT * FROM forum_site_concept");
	$description = $desc->fetch(PDO::FETCH_OBJ);
?>
      <!-- meta -->
      <meta charset="UTF-8"/>
      <meta name="keywords" content="Site,Communautaire,Sortie organisé,Leprojet,Le projet,leprojet"/>
      <!--portable -->
	  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
	  <meta name="description" content=""/>
	  <meta name="author" content=""/>
	  
	  <meta name="description" content="<?php echo $description->site_description; ?>"/>
      <meta name="author" content="Tester" />
	  <title><?php echo (isset($pageTitle)) ? htmlspecialchars($pageTitle) : SITE_NAME; ?></title>
<?php //getDesignName() retourne le thème du site que l'utilisateur à choisi 
		if(isMobile()){?>
        	<link rel="stylesheet" type="text/css" href="<?php echo $bpath; ?>/design/<?php echo getDesignName(); ?>/style.mobile.css" />
        <?php }else{ ?>
			<link rel="stylesheet" type="text/css" href="<?php echo $bpath; ?>/design/<?php echo getDesignName(); ?>/style.css" />
    	<?php } ?>
	<link rel="stylesheet" type="text/css" href="<?php echo $bpath; ?>/design/<?php echo getDesignName(); ?>/jquery-custom/jquery-ui-1.10.3.custom.min.css" />
	<base href="http://<?php echo htmlspecialchars($_SERVER['HTTP_HOST']); ?>/" />
	
	<!-- utils -->
	<script type="text/javascript" src="./javasscripts/utils.js"></script>

	<!-- jquery -->
	<script type="text/javascript" src="./javasscripts/jquery-1.9.1.js"></script>
	<script type="text/javascript" src="./javasscripts/jquery-ui-1.10.3.custom.min.js"></script>

	<!-- inscription -->
	<script type="text/javascript" src="./javasscripts/inscription.js"></script>


	<script type="text/javascript" src="./javasscripts/tooltip.js"></script>
	<!-- bbcode -->
	<script type="text/javascript" src="./javasscripts/bbcode.js"></script>
	<script type="text/javascript" src="./javasscripts/boite_de_dialogue.js"></script>
	<script type="text/javascript" src="./javasscripts/menu_avec_habilage.js"></script>
	<script type="text/javascript" src="./javasscripts/mperso.js"></script>
	<script type="text/javascript" src="./javasscripts/previsualisation.js"></script>
	<script type="text/javascript" src="./javasscripts/tous_smilies.js"></script>
	<!-- widget -->
    <script type="text/javascript" src="./javasscripts/widgets.js"></script>
	<!-- choix multiple -->
    <script type="text/javascript" src="./javasscripts/choix_multiple.js"></script>
	<!-- accordion -->
    <script type="text/javascript" src="./javasscripts/accordion.js"></script>
	<!-- widget -->
    <script type="text/javascript" src="./javasscripts/container.js"></script>
	<!-- supprimer le dernier bordure -->
    <script type="text/javascript" src="./javasscripts/supprimer_border_bottom.js"></script>
	<!-- carte france -->
    <script type="text/javascript" src="./javasscripts/script.js"></script>
    <script type="text/javascript" src="./javasscripts/raphael-min.js"></script>
	<?php
		echo Hook::call("KERNEL.ADD.CODE.JS");
	?>
	
</head>
<body>
<div id="frame">
<div id="global">
	<?php //$xajax->printJavascript(); ?>
	 
	<a id="top" title=""></a>
    <?php getMaintenance(); ?>
    
    <?php if(defined('SITE_LOGO'))
    { ?>
    <div id="logo">
		<a href="<?php echo getLienModule('index'); ?>"><img src="<?php echo SITE_LOGO; ?>" alt="<?php echo SITE_NAME; ?>" /></a>
	</div>
	<?php } ?>
    
	<div id="header">
		<?php require_once(DIR_INCLUDE . '/header.inc.php'); ?>
	</div>
	<?php
?>
	<div id="menu" class="accordeon">
		<?php require_once(DIR_INCLUDE . '/menu.inc.php'); ?>
	</div>
	
<script type="text/javascript">
// prepare l'accordeon si on en en dessous de 500 en width
$(function() {
	if(window.innerWidth < 500)
		{
			$(function() {
				$('#menu').attr("class","accordeon");
				$( ".accordeon" ).accordion();
			});
		}
});

//
window.onresize = function(event){
	
	// restauration de l'accordeon
	var restore = function (header,content)
	{
		header.attr("role","");content.attr("role","");
		header.attr("aria-expanded","");content.attr("aria-expanded","");
		header.attr("aria-selected","");content.attr("aria-selected","");
		header.attr("tabindex","");content.attr("tabindex","");
	};
	
	if(window.innerWidth < 500)
	{
		$(function() {
			$('#menu').attr("class","accordeon");
			$( ".accordeon" ).accordion();
		});
	} else {
		$(function() {
			try
			{
				$('#menu').accordion('destroy');
			}catch(err){
			}
			/*
			$('.ui-icon').remove();
			$('.ui-accordion-header').attr("class","contenuDuMenu");
			$('.contenuDuMenu').mouseover("");
			$('.ui-accordion-content').attr("class","contenuDuMenu");
			$('.contenuDuMenu').mouseover("");
			restore($('.ui-accordion-header'),$('.ui-accordion-content'));
			$('#menu').attr("class","");
			*/
		});
	}
};
</script>


	<div id="content">
		<?php
			
			$fil = buildBreadcrumb(@$_GET['m'], ((!isset($_GET['sm']) || $_GET['sm'] == '') ? "index" :  @$_GET['sm']));
			if(count($fil) > 0)
			{
				echo '<div id="fil_ariane"><ul class="breadcrumb">';
				
				$i = 0;
				$output = "";
				foreach($fil as $url => $item)
				{
					$url = explode('/', $url);
					$module = $url[0];
					
					$section = "index";
					if($i>0)
					$section = $url[0];
					
					$output1 = htmlspecialchars($item);
					
					if($i < count($fil)-1 && (count($fil) > 2 && $i<>(count($fil)/2)))
						$output .= '<li><a href="'.getLienModule($module, $section).'">'.$output1.'</a></li>';
					else if(count($fil) > 2 && $i==(count($fil)/2))
						$output .= '<li><a href="javascript:void(0);" onclick="history.back(-2);">'.$output1.'</a></li>';
					
					if(count($fil)-1==1) // && $i<1
						$output .= '<li><a href="'.getLienModule($module, $section).'">'.$output1.'</a></li>';
					else {
						//$output = '<li><a href="#">'.$output.'</a></li>';
					}

					$i++;
				}
				
				echo $output.'</ul></div>';
			}
//leprojet_var_debug($_SESSION);
	if(isset($_SESSION["id"])&&id2level($_SESSION["id"])==ADMIN)
echo code("<information>Mise à jour du kernel</information>")."<br /><a href=\"".getLienModule('cahierdecharge','detailCarnetDevInfoxp')."\">Voir la description de la Mise à jour du kernel</a> -> <strong>Mise à jour du 22/01/2014 par infoxp à 11h10</strong><br /><br /><br />";




if(!empty($_SESSION["messageCommunication"])) {
				 
				 $_SESSION["messageComLu"]++;
					 
				 	if($_SESSION["messageComLu"]>1) {
						//Comme la page se rafraichi 2 fois avant d'arriver au méssage alors on ruse
						$_SESSION["messageCommunication"]=""; 
						$_SESSION["messageComLu"] = 0;
					}else{
						$level = '<information> </information>';
						$basicLevelName = 'information';
						if(!empty($_SESSION["messageCommunicationLevel"])){
							$basicLevelName =  $_SESSION["messageCommunicationLevel"];
								switch($_SESSION["messageCommunicationLevel"]){
									case 'information' : 
										$level = '<information> </information>';
									break;
									case 'important' :
									case 'attention' : 
										$level = '<attention> </attention>';
									break;
									
									case 'question' : 
										$level = '<question> </question>';
									break;
									case 'erreur' : 
									case 'fatal' : 
										$level = '<erreur> </erreur>';
									break;
									
									default : 
										$basicLevelName = 'information';
										$level = '<information> </information>';
								}
						}
					echo '<div class="'.$basicLevelName.' redirection ">'.code($level).$_SESSION["messageCommunication"].'</div>';
					}
			 }else
				 	echo "";
					
			
			loadModule();
			
		?>
	</div>
	<div id="footer">
		<?php require_once(DIR_INCLUDE . '/footer.inc.php'); ?>
	</div>
    
    </div></div>
</body>
</html>
<?php
	ob_end_flush();
	
?>